package com.hspedu.spring.component;

import com.hspedu.spring.annotation.Autowire;
import com.hspedu.spring.annotation.Component;
import com.hspedu.spring.annotation.Scope;
import com.hspedu.spring.processor.InitializingBean;

/**
 * @author xianYun
 * @version 1.0
 **/
@Scope(value = "prototype")
@Component(value = "monsterService")//把 MonsterService 注入我们自己的 ioc 容器中
public class MonsterService implements InitializingBean {
    @Autowire
    private MonsterDao monsterDao;
    public void m1(){
        monsterDao.hi();
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("MonsterService 调用了初始化方法");
    }
}
